package com.xiaomei.manager.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xiaomei.manager.dao.BannerMapper;
import com.xiaomei.manager.model.Banner;
import com.xiaomei.manager.service.IBannerService;
import com.xiaomei.manager.web.dto.req.BannerQueryDto;
import com.xiaomei.manager.web.page.Page;
@Service
public class BannerServiceImpl implements IBannerService {
	
	@Autowired
	private BannerMapper bannerMapper;
	
	/**
	 * 根据请求参数map查询banner图信息
	 */
	@Override
	public List<Banner> getBannerForList(BannerQueryDto dto, Page<Banner> page) {
		// TODO Auto-generated method stub
		page.setParamDto(dto);
		return bannerMapper.selectByParamMap(page);
	}

	@Override
	public Integer selectMaxId() {
		// TODO Auto-generated method stub
		return bannerMapper.selectMaxId();
	}

	@Override
	public Boolean createBanner(Banner record) {
		// TODO Auto-generated method stub
		return bannerMapper.insertSelective(record)==1?true:false;
	}

	@Override
	public Banner findOne(Integer id) {
		// TODO Auto-generated method stub
		return bannerMapper.selectByPrimaryKey(id);
	}

	@Override
	public boolean updateBanner(Banner record) {
		// TODO Auto-generated method stub
		return bannerMapper.updateByPrimaryKeySelective(record)==1?true:false;
	}

	@Override
	public boolean deleteBanner(Integer id) {
		// TODO Auto-generated method stub
		return bannerMapper.deleteByPrimaryKey(id)==1?true:false;
	}

}
